﻿using DevExpress.ExpressApp.DC;
using DevExpress.Persistent.Base;
using EasyXaf.MongoDB;

namespace EasyXaf.Sample.Module.BusinessObjects;

[DomainComponent]
[MongoEntity]
[DefaultClassOptions]
[XafDisplayName("公司")]
public class Company : MongoEntity
{
    private string _name;
    private string _address;
    private string _description;

    [XafDisplayName("名称")]
    public string Name
    {
        get => _name;
        set => SetPropertyValue(ref _name, value);
    }

    [XafDisplayName("地址")]
    public string Address
    {
        get => _address;
        set => SetPropertyValue(ref _address, value);
    }

    [XafDisplayName("描述")]
    public string Description
    {
        get => _description;
        set => SetPropertyValue(ref _description, value);
    }

    [XafDisplayName("部门")]
    [MongoAssociation]
    public MongoEntityCollection<Department> Departments
    {
        get => GetEntityCollection<Department>();
    }
}
